<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('客户转移列表')" />
</head>
<body>
<form>
	<div class="layuiadmin-header-box">
		<th:block th:include="listinclude :: searchTop" />
	</div>
</form>
<div class="mid-content">
    <table class="layui-hide" id="dhtable" lay-filter="ftable"></table>
</div>
<script type="text/html" id="barDh">
	<a class="layui-btn layui-btn-danger layui-btn-xs dhicon dh-remove" onclick="remove('{{d.guid}}')" shiro:hasPermission="crm:customer:delete">&nbsp;删除</a>
</script>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = ctx + "crm/customertransfer";
	var gridColumns = [[${gridColumns}]];
	var moduleTable=[[${moduleTable}]];
	/*]]>*/
</script>
<script type="text/javascript">
var $,layer,form,table,wherestr={};
layui.use(['table','form','layer','jquery'], function () {
     $ = layui.$,layer = layui.layer,form = layui.form,table = layui.table;
     $.tablelist.init({
         elem: '#dhtable'
         ,url: prefix + '/transferlist'
         ,totalRow: gridColumns.totalRow
		 ,cols: [gridColumns.gridBody
		]
        ,toolbar: '#toolbar'
		,defaultToolbar: [{title:'列设置',layEvent: 'fieldSet',icon: 'layui-icon-set'}] //这里在右边显示
        ,height:'full-90'
     });
	//监听排序事件 
     table.on('sort(ftable)', function(obj){
     	$.tablelist.sort('dhtable',obj);
     });
	//搜索按钮
 	$('#btn-search').on('click', function () {
 		$.each(wherestr,function(i,v){$("#"+i).val()?wherestr[i]=$("#"+i).val():wherestr[i]='';});//动态获取条件的值
        table.reload('dhtable', {page: {curr: 1},where:wherestr});
	});
 	//监听下拉框——添加条件
 	form.on('select(fft)', function(obj){
 		addMore(this);
 	});
});
//通过guid彻底删除
function remove(guid){
	$.operate.remove("是否删除该记录？",prefix + "/transferdelete",{'guid':guid},function(result){
		if(result.code==0){
	        setTimeout(function(){
	            layer.closeAll();
	            table.reload('dhtable');
	        }, 1000);
	    }
	});
}
 </script>
</body>
</html>